<table border="0" cellpadding="0" cellspacing="4" width="100%">
	<tr>
		<td>
			<table border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td width="14"></td>
					<td width="120">
						<a href="index.php?admin=tags&axn=insert_tags">Alta de Tag</a>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr><td height="5"></td></tr>
	<tr>
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<?php
					$tagsQty = 0;
					$tagsCountString = "select sum(case when status='A' then 1 else 0 end) activos, sum(case when status='I' then 1 else 0 end) inactivos from tags";
					$tagsCountQuery = dbSelect($tagsCountString) or die("Error en ".$tagsCountString." ".mysql_error());
					if ($tagsCountResult = mysql_fetch_array($tagsCountQuery)) {
						$activetags = $tagsCountResult['activos'];
						$inactivetags = $tagsCountResult['inactivos'];
					}
					if($activetags>0 || $inactivetags>0) {
						echo "<tr><td>Se encontraron ".$activetags." tags activos</td></tr>";

						$tagsShowString = "select tag_id,name,status from tags order by status";
						$tagsShowQuery = dbSelect($tagsShowString) or die("Error en select ".$tagsShowString." ".mysql_error());
						?>
						<tr><td height="5"></td></tr>
						<tr><td><table border='1' cellpadding='1' cellspacing='0' width='100%'>
						<tr><td bgcolor="#CCCCCC" align="center"><b>TAG</b></td><td bgcolor="#CCCCCC" align="center"><b>ACCIONES</b></td></tr>
						<?php
						while($tagsShowResult = mysql_fetch_array($tagsShowQuery)) {
							echo "<tr>";
								//echo "<td>".$tagsShowResult['tag_id']."</td>";
								echo "<td width='100%'><a href='index.php?admin=noticias&tag_id=".$tagsShowResult['tag_id']."'>".$tagsShowResult['name']."</a></td>";
								echo "<td align='center'><table border='0' cellspacing='0' cellpadding='0' align='center'><tr>";
								echo "<td><a href='index.php?admin=tags&axn=update_tags&tag_id=".$tagsShowResult['tag_id']."'><img src='../img/b_edit.png' border='0' title='Modificar tag'></a></td>";
								echo "<td width='5'></td>";
								if($tagsShowResult['status']=='A') {
									echo "<td><a href='tags/operations.php?axn=inactivate_tags&tag_id=".$tagsShowResult['tag_id']."'><img src='../img/b_drop.png' border='0' title='Inactivar tag'></a></td>";
								} else {
									echo "<td><a href='tags/operations.php?axn=activate_tags&tag_id=".$tagsShowResult['tag_id']."'><img src='../img/s_okay.png' border='0' title='Activar tag'></a></td>";
								}
								echo "</tr></table></td></tr>";
						}
						echo "</table></td></tr>";
					} else {
						echo "<tr><td>No hay tags cargados</td></tr>";
					}


				?>
			</table>
		</td>
	</tr>
</table>